<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "d_try.order_discount".
 *
 * @property integer $type_id
 * @property integer $order_info_id
 * @property string $type
 * @property string $discount_money
 * @property string $describe
 * @property string $create_time
 */
class OrderDiscount extends \yii\db\ActiveRecord
{
    public function beforeSave($insert)
    {
        if($insert){
            $this->create_time = date('Y-m-d H:i:s');
        }
        return parent::beforeSave($insert);
    }

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'd_try.order_discount';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['type_id','order_info_id'], 'integer'],
            [['discount_money'], 'number'],
            [['create_time'], 'safe'],
            [['type'], 'string', 'max' => 20],
            [['describe'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'type_id' => 'Type ID',
            'order_info_id' => 'Order Info ID',
            'type' => 'Type',
            'discount_money' => 'Discount Money',
            'describe' => 'Describe',
            'create_time' => 'Create Time',
        ];
    }
}
